<?php
namespace Admin\Controller;
use Think\Controller;
class LoginController extends Controller {

	public function adminLogin(){
		$adminModel=M('admins');

		/*$condition=array{
			'adminname'=>$_POST['adminname'];
			'pass'=>I('post.password');
		}
		$admin=$adminModel->where($condition)->find();*/



		$adminname=$_POST['adminname'];
		$pass=md5($_POST['pass']);
		echo "$adminname"."  ".$pass;
		if($adminModel->where("pass='".$pass."' AND adminname='".$adminname."' ")->select()){
			/*$this->success('','../Index/users');*/
			session('admin',$adminname);
			$this->redirect('./Admin/Index/users');
		}else{
			$this->error("登录失败");
		}

	}
	public function adminExit()
	{
		session('admin',null); // 删除name
		$this->redirect('./Admin/Login/login');
	}

}